<div class="container-fluid">
	<div id="pad-wrapper">
		<div class="table-wrapper products-table section">
			<div class="row-fluid head">
				<div class="span12">
					<h4>兑奖</h4>
				</div>
			</div>

			<div class="row-fluid head">
				<div class="span12">
					<label>微信昵称：<?php echo $spreadList['wx_name']?></label>
				</div>
			</div>

			<div class="row-fluid head">
				<div class="span12">
					<label>当前兑奖状态：<?php echo $spreadList['grade_cn']?></label>
					<span><button type="button" id="gradebutton" class=" btn-flat primary <?php if(empty($spreadList['grade_button'])){ echo 'disabled" disabled="disabled"'; } ?> onclick="window.location.href='#'"><?php if(empty($spreadList['grade_button'])){	echo '不可兑奖';}else{echo $spreadList['grade_button'];}?></button></span>
					<input type="hidden" name="spreadid" id="spreadid" value= <?php echo $id ?>>
					<input type="hidden" name="gradeid" id="gradeid" value= <?php echo $spreadList['grade_button_id'] ?>>
				</div>
			</div>

			<div class="row-fluid head">
				<div class="span12">

				</div>
			</div>

			<div class="row-fluid">
				<table class="table table-hover">
					<thead>
					<tr>
						<th class="span3"><span class="line"></span>兑换到等级</th>
						<th class="span3"><span class="line"></span>操作员</th>
						<th class="span2"><span class="line"></span>兑换时间</th>
					</tr>
					</thead>
					<form action="/organization-apply/batch" method="post" name="batch">
						<tbody>
							<?php foreach ($prizeinfoList as $item):?>
								<tr class="first">
									<td class="description"> <?php echo $item['grade']?> </td>
									<td class="description"> <?php echo $item['operator']?> </td>
									<td class="description"> <?php echo date('Y-m-d G:i:s',$item['create_time'])?> </td>
								</tr>
							<?php endforeach; ?>
						</tbody>
					</form>
				</table>
			</div>
		</div>
		<!-- end products table -->
	</div>
	<style>
		h4{
			padding-bottom:25px;
		}
		label{
			display:inline-block;
			margin-right:10px;
			margin-left:20px;
			vertical-align:middle;
		}
		.disabled,.disabled:hover{
			background-color:#e6e6e6 !important;
			border:1px solid #e6e6e6 !important;
			color:gray;
		}
	</style>

	<script type="text/javascript">
		$(function () {
			$('#gradebutton').click(function () {
				$("#gradebutton").removeClass().addClass(" btn-flat primary disabled disabled='disabled'");
				$("#gradebutton").html("兑奖中.........");
				var $spreadid= $("#spreadid").val();
				var $gradeid= $("#gradeid").val();
				$.ajax({
					type:'get',
					url:'/prizeinfo/grade?spreadid='+$spreadid+'&gradeid='+$gradeid,
					cache:false,
					dataType:'json',
					success:function(data){
						if(data.result == 1)//success
						{
							window.location.reload();//刷新当前页面.
							$("#updateUserInfo").html("兑奖完成");
						}else{
							alert("失败");
							$("#updateUserInfo").html("兑奖失败");
						}
					},
					error:function(){
						alert("失败");
						$("#gradebutton").html("兑奖失败");
					}
				});
			})
		});
	</script>
</div>


